using System;
using System.Collections.Generic;
using System.Collections;
using System.Text;
//using KbWorksBlogMigrationtool.wss2003;
using System.Data;
using System.Xml;
using System.Net;
using System.Configuration;
using KbWorksBlogMigrationtool.wss2007SiteData;
namespace KbWorksBlogMigrationtool
{
    public class ListItemsitedata2010
    {
        AppSettingsReader conf = new AppSettingsReader();
        private string url = string.Empty;
        private string listName = string.Empty;
       // Logging log = new Logging();
        public ListItemsitedata2010(string Url, string ListName)
        {
            if (Url == String.Empty)
            {
                throw new ArgumentException("Parameter may not be String.Empty", "Url");
            }

            if (ListName == String.Empty)
            {
                throw new ArgumentException("Parameter may not be String.Empty", "ListName");
            }

            url = Url + "/_vti_bin/sitedata.asmx";
            listName = ListName;
        }

        public ArrayList GetSubItems(string listName,string queryUrl)
        {

            SiteData ListItems = new SiteData();
            ListItems.Url = url;
            ListItems.Credentials =
                new NetworkCredential(Convert.ToString(conf.GetValue("networkuser", typeof(string))),
                 Convert.ToString(conf.GetValue("networkpass", typeof(string))),
                 Convert.ToString(conf.GetValue("domain", typeof(string))));

            XmlDocument doc = new XmlDocument();
            XmlNode listItemsCollection = null;
            //Get the data from the list
            _sFPUrl[] enArray;
            
            ArrayList arr = new ArrayList();
           // listQueryOptions.InnerXml = "";

            try
            {
                ListItems.EnumerateFolder(queryUrl, out enArray);
                foreach (_sFPUrl en in enArray)
                {
                    arr.Add(en.Url); ;
                    
                }



                return arr;
            }

            catch (Exception ex)
            {
                
      //          log.append( string.Format(                   "Unable to get ListItems of {0} on {1}", listName, url) + ex.ToString(),4, "Webservice");
                return null;
            }
            finally
            {
                ListItems.Dispose();
            }

          
        }
    }
}